# 导入所需的库
from langchain_core.prompts import PromptTemplate
from langchain_core.output_parsers import StrOutputParser
from langchain_openai import OpenAI
# 原始字符串模板
template = "{flower}的花语是?只要告诉我花语，不要包含其他文字"
prompt = PromptTemplate.from_template(template)
# 创建模型实例
llm = OpenAI(temperature=0.9)
# 创建LLMChain
chain = prompt | llm | StrOutputParser()

# 调用LLMChain，返回结果
result = chain.invoke({"flower": "玫瑰"})
print(result)